/*
 * @Author: Li Zengkun
 * @Date: 2022-09-12 19:34:37
 * @LastEditors: Li Zengkun
 * @LastEditTime: 2022-09-13 17:12:26
 * @Description: menu api
 */
import axios from "axios"

// 获取所有菜单
const all = (params) => axios.get('/menu/all', { params })

// 获取所有子集菜单
const sub = (params) => axios.get('/menu/sub', { params })

// 设置菜单图标
const setIcon = (id, formData) => axios.put(`/menu/icon/${id}`, formData)

// 添加菜单
const add = (data) => axios.post('/menu', data)

// 更新菜单
const update = (id, formData) => axios.put(`/menu/${id}`, formData)

// 删除菜单
const remove = (id, params) => axios.delete(`/menu/${id}`, { params })

export default {
    all,
    sub,
    setIcon,
    add,
    update,
    remove
}